package decorator

type FriedEgg struct {
	name       string
	price      float64
	stapleFood StapleFood
}

func CreateFriedEgg(stapleFood StapleFood) StapleFood {
	res := new(FriedEgg)
	res.name = "煎蛋"
	res.price = 2.0
	res.stapleFood = stapleFood
	return res
}

func (sf *FriedEgg) getPrice() float64 {
	return sf.price + sf.stapleFood.getPrice()
}

func (sf *FriedEgg) getName() string {
	return sf.stapleFood.getName() + "+" + sf.name
}

////////////////////////////////////////////

type Sausage struct {
	name       string
	price      float64
	stapleFood StapleFood
}

func CreateSausage(stapleFood StapleFood) StapleFood {
	res := new(Sausage)
	res.name = "火腿肠"
	res.price = 2.5
	res.stapleFood = stapleFood
	return res
}

func (sf *Sausage) getPrice() float64 {
	return sf.price + sf.stapleFood.getPrice()
}

func (sf *Sausage) getName() string {
	return sf.stapleFood.getName() + "+" + sf.name
}
